package com.alibaba.nacos.core.cluster;

import java.util.HashMap;
import java.util.Map;

public class MemberUtil {
    private static final int DEFAULT_RAFT_OFFSET_PORT = 1000;

    public static Member singleParse(String address,
                                     int port) {
        Member member = new Member().setIp(address).setPort(port);

        Map<String, Object> extInfo = new HashMap<>();
        extInfo.put("raftPort", port - DEFAULT_RAFT_OFFSET_PORT);
        extInfo.put("readyToUpgrade", true);
        member.setExtendInfo(extInfo);

        member.setGrpcReportEnabled(true);
        return member;
    }

}
